{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ff7e01b0",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calRoot2():\n",
    "    print(\"The root of 2 is\",1.414)\n",
    "    return 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "dd7edbd4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The root of 2 is 1.414\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calRoot2()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d2c8281d",
   "metadata": {},
   "outputs": [],
   "source": [
    "def people(name, age):\n",
    "    print(name, \" is\", age, \" years old.\")\n",
    "    return 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "77750fcc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ZHAO  is 30  years old.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "people('ZHAO', 30)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c6f5d396",
   "metadata": {},
   "outputs": [],
   "source": [
    "name = 'MA ZIQUAN'\n",
    "age = 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "c0930032",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MA ZIQUAN  is 19  years old.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "people(name, age)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "984b7de6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "true\n"
     ]
    }
   ],
   "source": [
    "x = 6\n",
    "y = 4\n",
    "if x > 0 :\n",
    "    if x > y:\n",
    "        print (\"true\")\n",
    "    else:\n",
    "        print (\"false\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "79414d3a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "You need fight up!!!\n"
     ]
    }
   ],
   "source": [
    "if age > 40:\n",
    "    print (\"You are too old！！\")\n",
    "elif age < 18:\n",
    "    print (\"You are so young!\")\n",
    "else :\n",
    "    print (\"You need fight up!!!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "17cfd883",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "M\n",
      "A\n",
      " \n",
      "Z\n",
      "I\n",
      "Q\n",
      "U\n",
      "A\n",
      "N\n"
     ]
    }
   ],
   "source": [
    "for i in name :\n",
    "    print (i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "518019ee",
   "metadata": {},
   "outputs": [],
   "source": [
    "mylist = [1,1,2,3,6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "4adb5b65",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "2\n",
      "3\n",
      "4\n",
      "7\n"
     ]
    }
   ],
   "source": [
    "for num in mylist :\n",
    "    num1 = num + 1\n",
    "    print (num1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "928f63ee",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n",
      "4\n",
      "5\n",
      "6\n",
      "7\n",
      "8\n",
      "9\n",
      "10\n"
     ]
    }
   ],
   "source": [
    "i = 0\n",
    "while i < 10:\n",
    "    i = i + 1\n",
    "    print (i)"
   ]
  },
  {
   "cell_type": "code",
<<<<<<< HEAD
   "execution_count": 23,
=======
   "execution_count": 2,
>>>>>>> 2f12bae (Exercise_1_root2)
   "id": "bb1dbe85",
   "metadata": {},
   "outputs": [],
   "source": [
    "def ROOT (t):\n",
    "    i=0\n",
    "    x=10\n",
    "    while i < 1000:\n",
    "        x = (t / (2 * x)) + (x / 2)\n",
    "        i += 1\n",
    "    print (x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "ccc72a2e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.414213562373095\n"
     ]
    }
   ],
   "source": [
    "ROOT (2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "60d1f2b5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.7320508075688772\n"
     ]
    }
   ],
   "source": [
    "ROOT (3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "fe3c67db",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.0\n"
     ]
    }
   ],
   "source": [
    "ROOT (4)"
   ]
  },
  {
   "cell_type": "code",
<<<<<<< HEAD
   "execution_count": null,
   "id": "40eb6734",
   "metadata": {},
=======
   "execution_count": 3,
   "id": "40eb6734",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.6055512754639896\n"
     ]
    }
   ],
   "source": [
    "ROOT(13)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "06a0c731",
   "metadata": {},
>>>>>>> 2f12bae (Exercise_1_root2)
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
